package com.start.platform.core.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.start.platform.core.entity.StartPlatformConfigEntity;
import com.start.platform.core.mappers.StartPlatformConfigMapper;
import com.start.platform.core.service.StartPlatformConfigService;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class StartPlatformConfigServiceImpl extends ServiceImpl<StartPlatformConfigMapper, StartPlatformConfigEntity> implements StartPlatformConfigService {


    @Override
    public List<StartPlatformConfigEntity> listByPlatformType(String platformType) {
        LambdaQueryWrapper<StartPlatformConfigEntity> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(StartPlatformConfigEntity::getPlatformType, platformType);
        return list(queryWrapper);
    }

    @Override
    public StartPlatformConfigEntity getByPlatformTypeAppId(String platformType, String appId) {
        LambdaQueryWrapper<StartPlatformConfigEntity> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(StartPlatformConfigEntity::getPlatformType, platformType);
        queryWrapper.eq(StartPlatformConfigEntity::getAppId, appId);
        return getOne(queryWrapper, false);

    }


}
